import cv2

cat_rgb = cv2.imread("../images/cat.jpg", 1)  # BGR 图片
cat_gray = cv2.imread("../images/cat.jpg", cv2.IMREAD_GRAYSCALE)

print(cat_rgb.shape)  # (250,250,3)
print(cat_gray.shape)  # (250,250)

print("彩色图片:")
print(cat_rgb)

print("灰度图片:")
print(cat_gray)

cv2.imshow("cat_rgb", cat_rgb)  # 显示图片
cv2.imshow("cat_gray", cat_gray)  # 显示图片
cv2.waitKey()  # 等待键盘输入